﻿#include "FITKAcousticsFENodeMap.h"
#include "FITKAcousticsDiscModel.h"
#include "FITKAcousticsFEModel.h"
#include "FITK_Kernel/FITKCore/FITKDataRepo.h"

namespace Acoustics
{
    void FITKAcousticsFENodeMap::setPartID(int partID)
    {
        m_partID = partID;
    }

    int FITKAcousticsFENodeMap::getPartID()
    {
        return m_partID;
    }

    void FITKAcousticsFENodeMap::setNodeMap(int nodeFEID, int nodeDiscID)
    {
        m_nodesMap.insert(nodeFEID, nodeDiscID);
    }

    int FITKAcousticsFENodeMap::getDiscNodeID(int nodeFEID)
    {
        return m_nodesMap.value(nodeFEID);
    }

    FITKAcousticsFENodeMap* FITKAcousticsFENodeMapManager::getFENodeMapByPartID(int partID)
    {
        int count = this->getDataCount();
        for (int i = 0; i < count; ++i)
        {
            FITKAcousticsFENodeMap* nodeMap = this->getDataByIndex(i);
            if (nodeMap && nodeMap->getPartID() == partID)
                return nodeMap;
        }
        return nullptr;
    }
}



